package com.funny.learning.english.activity;

import java.util.ArrayList;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.ListView;
import android.widget.TextView;

import com.funny.learning.english.BaseActivity;
import com.funny.learning.english.R;
import com.funny.learning.english.adapter.LearnedCourseAdapter;
import com.funny.learning.english.model.CourseEntity.Level;

public class CourseLearnedActivity extends BaseActivity{
	private ListView lvLearned;
	private Button btHistory;
	private Button btLogout;
	private TextView tvName;
	private TextView tvCoin;
	private Button btAddCourse;
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.accout_layout);
		
		initSlide();
		
	}
	private void initSlide(){
		lvLearned = (ListView)findViewById(R.id.lvLearned);
		btHistory = (Button)findViewById(R.id.btHistory);
		btLogout = (Button)findViewById(R.id.btLogout);
		tvName = (TextView)findViewById(R.id.tvName);
		tvCoin = (TextView)findViewById(R.id.tvCoin);
		btAddCourse = (Button)findViewById(R.id.btAddCourse);
		
//		tvName.setText(appication.getUserEntity().getName());
//		tvCoin.setText("Tài khoản: " + appication.getUserEntity().getCoint());
		
		btHistory.setOnClickListener(new OnClickListener() {
			
			@Override
			public void onClick(View arg0) {
				Intent intent = new Intent(activity, HisotyActivity.class);
				startActivity(intent);
			}
		});
		btLogout.setOnClickListener(new OnClickListener() {
			
			@Override
			public void onClick(View paramView) {
//				logout();
			}
		});
		
		btAddCourse.setOnClickListener(new OnClickListener() {
			
			@Override
			public void onClick(View arg0) {
				Intent intent = new Intent(activity, ListCourseActivity.class);
				startActivity(intent);
			}
		});
		
		Level level1 = new Level("1234", "Khoa hoc co ban", 1000, 1);
		Level level2 = new Level("1234", "Khoa hoc co ban", 1000, 1);
		Level level3 = new Level("1234", "Khoa hoc co ban", 1000, 1);
		Level level4 = new Level("1234", "Khoa hoc co ban", 1000, 1);
		Level level5 = new Level("1234", "Khoa hoc co ban", 1000, 1);
		Level level6 = new Level("1234", "Khoa hoc co ban", 1000, 1);
		Level level7 = new Level("1234", "Khoa hoc co ban", 1000, 1);
		Level level8 = new Level("1234", "Khoa hoc co ban", 1000, 1);
		
		ArrayList<Level> levels = new ArrayList<Level>();
		levels.add(level1);
		levels.add(level2);
		levels.add(level3);
		levels.add(level4);
		levels.add(level5);
		levels.add(level6);
		levels.add(level7);
		levels.add(level8);
		
		LearnedCourseAdapter learnedCourseAdapter = new LearnedCourseAdapter(activity, levels);
		
		lvLearned.setAdapter(learnedCourseAdapter);
	}
}
